package com.h2cloud;


import lombok.Data;

import java.util.*;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.FutureTask;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.LockSupport;
import java.util.concurrent.locks.ReentrantLock;

/**
 * @Package: com.h2cloud
 * @ClassName: test
 * @Author: h2cloud
 * @CreateTime: 2021/10/25 11:05 上午
 * @Description:
 */

interface a {
	public void say();
}

class father {
	public void say() {
		System.out.println("father");
	}
}

class son extends father implements a {

}

public class test {
	public static void main(String[] args) {
		// son son = new son();
		// son.say();

		// AtomicInteger integer = new AtomicInteger();
		// while (true) {
		// 	int andIncrement = integer.getAndIncrement();
		// 	if (andIncrement >= 2147483647 || andIncrement <= 0) {
		// 		System.out.println("andIncrement = " + andIncrement);
		// 		try {
		// 			Thread.sleep(3000);
		// 		} catch (InterruptedException e) {
		// 			e.printStackTrace();
		// 		}
		// 	}
		// }

		person p = new person();
		ExecutorService executor = Executors.newFixedThreadPool(50);
		for (int i = 0; i < 100; i++) {
			int finalI = i;
			executor.submit(() -> {
				p.sayHello(finalI + "");
			});
		}
		// executor.shutdown();


	}
}

class person {
	public void sayHello(String name) {
		System.out.println("inter method");
		int nextInt = new Random().nextInt(4000);
		try {
			Thread.sleep(nextInt);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		System.out.println("name = " + name);
	}
}
